library(dplyr)
library(tidyr)
library(caret)
library(pamr)
library(ggplot2)

#similar model building script as before, but here we're subsetting by author gender
#once again, the code in this script is rough. (was just learning R at the time)

in_dir <- "/Users/cheng/OneDrive/Desktop/character/character/3_prepare_samples/output_sample_data/"
in_files <- dir(in_dir)
file_names <- file.path(in_dir,in_files)

MtotalACC <- list()
FtotalACC <- list()
cmFAUTHS<- list()
precFAUTHS<- list()
recallFAUTHS <- list()
cmMAUTHS<- list()
precMAUTHS<- list()
recallMAUTHS <- list()
sensFAUTHS<- list()
specFAUTHS<- list()
sensMAUTHS <- list()
specMAUTHS <- list()
negpredFAUTHS <- list()
negpredMAUTHS <- list()

M1850ACC <- list()
F1850ACC <- list()
cm1850FAUTHS<- list()
prec1850FAUTHS<- list()
recall1850FAUTHS <- list()
cm1850MAUTHS<- list()
prec1850MAUTHS<- list()
recall1850MAUTHS<- list()
sens1850FAUTHS<- list()
spec1850FAUTHS<- list()
sens1850MAUTHS <- list()
spec1850MAUTHS <- list()
negpred1850FAUTHS <- list()
negpred1850MAUTHS <- list()

M1860ACC <- list()
F1860ACC <- list()
cm1860FAUTHS<- list()
prec1860FAUTHS<- list()
recall1860FAUTHS <- list()
cm1860MAUTHS<- list()
prec1860MAUTHS<- list()
recall1860MAUTHS<- list()
sens1860FAUTHS<- list()
spec1860FAUTHS<- list()
sens1860MAUTHS <- list()
spec1860MAUTHS <- list()
negpred1860FAUTHS <- list()
negpred1860MAUTHS <- list()

M1870ACC <- list()
F1870ACC <- list()
cm1870FAUTHS<- list()
prec1870FAUTHS<- list()
recall1870FAUTHS <- list()
cm1870MAUTHS<- list()
prec1870MAUTHS<- list()
recall1870MAUTHS<- list()
sens1870FAUTHS<- list()
spec1870FAUTHS<- list()
sens1870MAUTHS <- list()
spec1870MAUTHS <- list()
negpred1870FAUTHS <- list()
negpred1870MAUTHS <- list()

M1880ACC <- list()
F1880ACC <- list()
cm1880FAUTHS<- list()
prec1880FAUTHS<- list()
recall1880FAUTHS <- list()
cm1880MAUTHS<- list()
prec1880MAUTHS<- list()
recall1880MAUTHS<- list()
sens1880FAUTHS<- list()
spec1880FAUTHS<- list()
sens1880MAUTHS <- list()
spec1880MAUTHS <- list()
negpred1880FAUTHS <- list()
negpred1880MAUTHS <- list()

M1890ACC <- list()
F1890ACC <- list()
cm1890FAUTHS<- list()
prec1890FAUTHS<- list()
recall1890FAUTHS <- list()
cm1890MAUTHS<- list()
prec1890MAUTHS<- list()
recall1890MAUTHS<- list()
sens1890FAUTHS<- list()
spec1890FAUTHS<- list()
sens1890MAUTHS <- list()
spec1890MAUTHS <- list()
negpred1890FAUTHS <- list()
negpred1890MAUTHS <- list()

M1900ACC <- list()
F1900ACC <- list()
cm1900FAUTHS<- list()
prec1900FAUTHS<- list()
recall1900FAUTHS <- list()
cm1900MAUTHS<- list()
prec1900MAUTHS<- list()
recall1900MAUTHS<- list()
sens1900FAUTHS<- list()
spec1900FAUTHS<- list()
sens1900MAUTHS <- list()
spec1900MAUTHS <- list()
negpred1900FAUTHS <- list()
negpred1900MAUTHS <- list()

M1910ACC <- list()
F1910ACC <- list()
cm1910FAUTHS<- list()
prec1910FAUTHS<- list()
recall1910FAUTHS <- list()
cm1910MAUTHS<- list()
prec1910MAUTHS<- list()
recall1910MAUTHS<- list()
sens1910FAUTHS<- list()
spec1910FAUTHS<- list()
sens1910MAUTHS <- list()
spec1910MAUTHS <- list()
negpred1910FAUTHS <- list()
negpred1910MAUTHS <- list()

M1920ACC <- list()
F1920ACC <- list()
cm1920FAUTHS<- list()
prec1920FAUTHS<- list()
recall1920FAUTHS <- list()
cm1920MAUTHS<- list()
prec1920MAUTHS<- list()
recall1920MAUTHS<- list()
sens1920FAUTHS<- list()
spec1920FAUTHS<- list()
sens1920MAUTHS <- list()
spec1920MAUTHS <- list()
negpred1920FAUTHS <- list()
negpred1920MAUTHS <- list()

M1930ACC <- list()
F1930ACC <- list()
cm1930FAUTHS<- list()
prec1930FAUTHS<- list()
recall1930FAUTHS <- list()
cm1930MAUTHS<- list()
prec1930MAUTHS<- list()
recall1930MAUTHS<- list()
sens1930FAUTHS<- list()
spec1930FAUTHS<- list()
sens1930MAUTHS <- list()
spec1930MAUTHS <- list()
negpred1930FAUTHS <- list()
negpred1930MAUTHS <- list()

M1940ACC <- list()
F1940ACC <- list()
cm1940FAUTHS<- list()
prec1940FAUTHS<- list()
recall1940FAUTHS <- list()
cm1940MAUTHS<- list()
prec1940MAUTHS<- list()
recall1940MAUTHS<- list()
sens1940FAUTHS<- list()
spec1940FAUTHS<- list()
sens1940MAUTHS <- list()
spec1940MAUTHS <- list()
negpred1940FAUTHS <- list()
negpred1940MAUTHS <- list()

M1950ACC <- list()
F1950ACC <- list()
cm1950FAUTHS<- list()
prec1950FAUTHS<- list()
recall1950FAUTHS <- list()
cm1950MAUTHS<- list()
prec1950MAUTHS<- list()
recall1950MAUTHS<- list()
sens1950FAUTHS<- list()
spec1950FAUTHS<- list()
sens1950MAUTHS <- list()
spec1950MAUTHS <- list()
negpred1950FAUTHS <- list()
negpred1950MAUTHS <- list()

M1960ACC <- list()
F1960ACC <- list()
cm1960FAUTHS<- list()
prec1960FAUTHS<- list()
recall1960FAUTHS <- list()
cm1960MAUTHS<- list()
prec1960MAUTHS<- list()
recall1960MAUTHS<- list()
sens1960FAUTHS<- list()
spec1960FAUTHS<- list()
sens1960MAUTHS <- list()
spec1960MAUTHS <- list()
negpred1960FAUTHS <- list()
negpred1960MAUTHS <- list()

M1970ACC <- list()
F1970ACC <- list()
cm1970FAUTHS<- list()
prec1970FAUTHS<- list()
recall1970FAUTHS <- list()
cm1970MAUTHS<- list()
prec1970MAUTHS<- list()
recall1970MAUTHS<- list()
sens1970FAUTHS<- list()
spec1970FAUTHS<- list()
sens1970MAUTHS <- list()
spec1970MAUTHS <- list()
negpred1970FAUTHS <- list()
negpred1970MAUTHS <- list()

M1980ACC <- list()
F1980ACC <- list()
cm1980FAUTHS<- list()
prec1980FAUTHS<- list()
recall1980FAUTHS <- list()
cm1980MAUTHS<- list()
prec1980MAUTHS<- list()
recall1980MAUTHS<- list()
sens1980FAUTHS<- list()
spec1980FAUTHS<- list()
sens1980MAUTHS <- list()
spec1980MAUTHS <- list()
negpred1980FAUTHS <- list()
negpred1980MAUTHS <- list()

M1990ACC <- list()
F1990ACC <- list()
cm1990FAUTHS<- list()
prec1990FAUTHS<- list()
recall1990FAUTHS <- list()
cm1990MAUTHS<- list()
prec1990MAUTHS<- list()
recall1990MAUTHS<- list()
sens1990FAUTHS<- list()
spec1990FAUTHS<- list()
sens1990MAUTHS <- list()
spec1990MAUTHS <- list()
negpred1990FAUTHS <- list()
negpred1990MAUTHS <- list()

M2000ACC <- list()
F2000ACC <- list()
cm2000FAUTHS<- list()
prec2000FAUTHS<- list()
recall2000FAUTHS <- list()
cm2000MAUTHS<- list()
prec2000MAUTHS<- list()
recall2000MAUTHS<- list()
sens2000FAUTHS<- list()
spec2000FAUTHS<- list()
sens2000MAUTHS <- list()
spec2000MAUTHS <- list()
negpred2000FAUTHS <- list()
negpred2000MAUTHS <- list()

for(g in 1:length(file_names)){
  load(file_names[g])
  
  ##Create a model on two centuries of data, subset by author gender
  ##################################################################
  ##################################################################
  classingMAUTHS <- test_allData %>%
    filter(auth_gender %in% "M") %>%
    ungroup() %>%
    select(-one_of("file_name","pub_decade","auth_gender")) %>%
    rename(Class = gender)
  
  justMAUTHS <- classingMAUTHS %>%
    select(-one_of("Class"))
  
  down_MAUTHS <- downSample(x=justMAUTHS, y=as.factor(classingMAUTHS$Class))
  
  classingFAUTHS <- test_allData %>%
    filter(auth_gender %in% "F") %>%
    ungroup() %>% 
    select(-one_of("file_name","pub_decade", "auth_gender")) %>% 
    rename(Class = gender)
  
  justFAUTHS <- classingFAUTHS %>%
    select(-one_of("Class"))
  
  down_FAUTHS <- downSample(x=justFAUTHS, y=as.factor(classingFAUTHS$Class))
  
  ctrl <- trainControl(method = "repeatedcv", repeats = 5, classProbs = TRUE)
  
  set.seed(1996)
  
  class_MAUTHS <- train(Class ~ ., data = down_MAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  class_FAUTHS <- train(Class ~ ., data = down_FAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  ##Tabulate Accuracies
  ##################################################################
  MtotalACC[[g]] <- class_MAUTHS$results$Accuracy[1]
  FtotalACC[[g]] <- class_FAUTHS$results$Accuracy[1]
  
  ##Grab Confusion Matrix, Transform to DataFrame
  ##################################################################
  cmM <- confusionMatrix(class_MAUTHS)
  cmMAUTHS[[g]] <- as.data.frame(cmM$table) %>%
    mutate(sample = g)
  
  cmF <- confusionMatrix(class_FAUTHS)
  cmFAUTHS[[g]] <- as.data.frame(cmF$table) %>%
    mutate(sample = g)
  
  ##Tabulate Precision and Recall
  ##################################################################
  precFAUTHS[[g]] <- precision(cmF$table)
  recallFAUTHS[[g]] <- recall(cmF$table)
  precMAUTHS[[g]] <- precision(cmM$table)
  recallMAUTHS[[g]] <- recall(cmM$table)
  
  sensFAUTHS[[g]] <- sensitivity(cmF$table)
  specFAUTHS[[g]]<- specificity(cmF$table)
  sensMAUTHS[[g]] <- sensitivity(cmM$table)
  specMAUTHS[[g]]<- specificity(cmM$table)
  
  negpredFAUTHS[[g]] <- negPredValue(cmF$table)
  negpredMAUTHS[[g]] <- negPredValue(cmM$table)
  
  ##Create a model on the 1850s
  ##################################################################
  ##################################################################
  classingMAUTHS <- test_allData %>%
    filter(auth_gender %in% "M", pub_decade %in% 1850) %>%
    ungroup() %>%
    select(-one_of("file_name","pub_decade","auth_gender")) %>%
    rename(Class = gender)
  
  justMAUTHS <- classingMAUTHS %>%
    select(-one_of("Class"))
  
  down_MAUTHS <- downSample(x=justMAUTHS, y=as.factor(classingMAUTHS$Class))
  
  classingFAUTHS <- test_allData %>%
    filter(auth_gender %in% "F", pub_decade %in% 1850) %>%
    ungroup() %>% 
    select(-one_of("file_name","pub_decade", "auth_gender")) %>% 
    rename(Class = gender)
  
  justFAUTHS <- classingFAUTHS %>%
    select(-one_of("Class"))
  
  down_FAUTHS <- downSample(x=justFAUTHS, y=as.factor(classingFAUTHS$Class))
  
  ctrl <- trainControl(method = "repeatedcv", repeats = 5, classProbs = TRUE)
  
  set.seed(1996)
  
  class_MAUTHS <- train(Class ~ ., data = down_MAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  class_FAUTHS <- train(Class ~ ., data = down_FAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  
  ##Tabulate Accuracies
  ##################################################################
  M1850ACC[[g]] <- class_MAUTHS$results$Accuracy[1]
  F1850ACC[[g]] <- class_FAUTHS$results$Accuracy[1]
  
  ##Grab Confusion Matrix, Transform to DataFrame
  ##################################################################
  cmM <- confusionMatrix(class_MAUTHS)
  cm1850MAUTHS[[g]] <- as.data.frame(cmM$table) %>%
    mutate(sample = g)
  
  cmF <- confusionMatrix(class_FAUTHS)
  cm1850FAUTHS[[g]] <- as.data.frame(cmF$table) %>%
    mutate(sample = g)
  
  ##Tabulate Precision and Recall
  ##################################################################
  prec1850FAUTHS[[g]] <- precision(cmF$table)
  recall1850FAUTHS[[g]] <- recall(cmF$table)
  prec1850MAUTHS[[g]] <- precision(cmM$table)
  recall1850MAUTHS[[g]] <- recall(cmM$table)
  
  sens1850FAUTHS[[g]] <- sensitivity(cmF$table)
  spec1850FAUTHS[[g]]<- specificity(cmF$table)
  sens1850MAUTHS[[g]] <- sensitivity(cmM$table)
  spec1850MAUTHS[[g]]<- specificity(cmM$table)
  
  negpred1850FAUTHS[[g]] <- negPredValue(cmF$table)
  negpred1850MAUTHS[[g]] <- negPredValue(cmM$table)
  
  ##Create a model on the 1860s
  ##################################################################
  ##################################################################
  classingMAUTHS <- test_allData %>%
    filter(auth_gender %in% "M", pub_decade %in% 1860) %>%
    ungroup() %>%
    select(-one_of("file_name","pub_decade","auth_gender")) %>%
    rename(Class = gender)
  
  justMAUTHS <- classingMAUTHS %>%
    select(-one_of("Class"))
  
  down_MAUTHS <- downSample(x=justMAUTHS, y=as.factor(classingMAUTHS$Class))
  
  classingFAUTHS <- test_allData %>%
    filter(auth_gender %in% "F", pub_decade %in% 1860) %>%
    ungroup() %>% 
    select(-one_of("file_name","pub_decade", "auth_gender")) %>% 
    rename(Class = gender)
  
  justFAUTHS <- classingFAUTHS %>%
    select(-one_of("Class"))
  
  down_FAUTHS <- downSample(x=justFAUTHS, y=as.factor(classingFAUTHS$Class))
  
  ctrl <- trainControl(method = "repeatedcv", repeats = 5, classProbs = TRUE)
  
  set.seed(1996)
  
  class_MAUTHS <- train(Class ~ ., data = down_MAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  class_FAUTHS <- train(Class ~ ., data = down_FAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  
  ##Tabulate Accuracies
  ##################################################################
  M1860ACC[[g]] <- class_MAUTHS$results$Accuracy[1]
  F1860ACC[[g]] <- class_FAUTHS$results$Accuracy[1]
  
  ##Grab Confusion Matrix, Transform to DataFrame
  ##################################################################
  cmM <- confusionMatrix(class_MAUTHS)
  cm1860MAUTHS[[g]] <- as.data.frame(cmM$table) %>%
    mutate(sample = g)
  
  cmF <- confusionMatrix(class_FAUTHS)
  cm1860FAUTHS[[g]] <- as.data.frame(cmF$table) %>%
    mutate(sample = g)
  
  ##Tabulate Precision and Recall
  ##################################################################
  prec1860FAUTHS[[g]] <- precision(cmF$table)
  recall1860FAUTHS[[g]] <- recall(cmF$table)
  prec1860MAUTHS[[g]] <- precision(cmM$table)
  recall1860MAUTHS[[g]] <- recall(cmM$table)
  
  sens1860FAUTHS[[g]] <- sensitivity(cmF$table)
  spec1860FAUTHS[[g]]<- specificity(cmF$table)
  sens1860MAUTHS[[g]] <- sensitivity(cmM$table)
  spec1860MAUTHS[[g]]<- specificity(cmM$table)
  
  negpred1860FAUTHS[[g]] <-negPredValue(cmF$table)
  negpred1860MAUTHS[[g]] <-negPredValue(cmM$table)
  
  ##Create a model on the 1870s
  ##################################################################
  ##################################################################
  classingMAUTHS <- test_allData %>%
    filter(auth_gender %in% "M", pub_decade %in% 1870) %>%
    ungroup() %>%
    select(-one_of("file_name","pub_decade","auth_gender")) %>%
    rename(Class = gender)
  
  justMAUTHS <- classingMAUTHS %>%
    select(-one_of("Class"))
  
  down_MAUTHS <- downSample(x=justMAUTHS, y=as.factor(classingMAUTHS$Class))
  
  classingFAUTHS <- test_allData %>%
    filter(auth_gender %in% "F", pub_decade %in% 1870) %>%
    ungroup() %>% 
    select(-one_of("file_name","pub_decade", "auth_gender")) %>% 
    rename(Class = gender)
  
  justFAUTHS <- classingFAUTHS %>%
    select(-one_of("Class"))
  
  down_FAUTHS <- downSample(x=justFAUTHS, y=as.factor(classingFAUTHS$Class))
  
  ctrl <- trainControl(method = "repeatedcv", repeats = 5, classProbs = TRUE)
  
  set.seed(1996)
  
  class_MAUTHS <- train(Class ~ ., data = down_MAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  class_FAUTHS <- train(Class ~ ., data = down_FAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  
  ##Tabulate Accuracies
  ##################################################################
  M1870ACC[[g]] <- class_MAUTHS$results$Accuracy[1]
  F1870ACC[[g]] <- class_FAUTHS$results$Accuracy[1]
  
  ##Grab Confusion Matrix, Transform to DataFrame
  ##################################################################
  cmM <- confusionMatrix(class_MAUTHS)
  cm1870MAUTHS[[g]] <- as.data.frame(cmM$table) %>%
    mutate(sample = g)
  
  cmF <- confusionMatrix(class_FAUTHS)
  cm1870FAUTHS[[g]] <- as.data.frame(cmF$table) %>%
    mutate(sample = g)
  
  ##Tabulate Precision and Recall
  ##################################################################
  prec1870FAUTHS[[g]] <- precision(cmF$table)
  recall1870FAUTHS[[g]] <- recall(cmF$table)
  prec1870MAUTHS[[g]] <- precision(cmM$table)
  recall1870MAUTHS[[g]] <- recall(cmM$table)
  
  sens1870FAUTHS[[g]] <- sensitivity(cmF$table)
  spec1870FAUTHS[[g]]<- specificity(cmF$table)
  sens1870MAUTHS[[g]] <- sensitivity(cmM$table)
  spec1870MAUTHS[[g]]<- specificity(cmM$table)
  
  negpred1870FAUTHS[[g]] <-negPredValue(cmF$table)
  negpred1870MAUTHS[[g]] <-negPredValue(cmM$table)
  
  ##Create a model on the 1880s
  ##################################################################
  ##################################################################
  classingMAUTHS <- test_allData %>%
    filter(auth_gender %in% "M", pub_decade %in% 1880) %>%
    ungroup() %>%
    select(-one_of("file_name","pub_decade","auth_gender")) %>%
    rename(Class = gender)
  
  justMAUTHS <- classingMAUTHS %>%
    select(-one_of("Class"))
  
  down_MAUTHS <- downSample(x=justMAUTHS, y=as.factor(classingMAUTHS$Class))
  
  classingFAUTHS <- test_allData %>%
    filter(auth_gender %in% "F", pub_decade %in% 1880) %>%
    ungroup() %>% 
    select(-one_of("file_name","pub_decade", "auth_gender")) %>% 
    rename(Class = gender)
  
  justFAUTHS <- classingFAUTHS %>%
    select(-one_of("Class"))
  
  down_FAUTHS <- downSample(x=justFAUTHS, y=as.factor(classingFAUTHS$Class))
  
  ctrl <- trainControl(method = "repeatedcv", repeats = 5, classProbs = TRUE)
  
  set.seed(1996)
  
  class_MAUTHS <- train(Class ~ ., data = down_MAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  class_FAUTHS <- train(Class ~ ., data = down_FAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  ##Tabulate Accuracies
  ##################################################################
  M1880ACC[[g]] <- class_MAUTHS$results$Accuracy[1]
  F1880ACC[[g]] <- class_FAUTHS$results$Accuracy[1]
  
  ##Grab Confusion Matrix, Transform to DataFrame
  ##################################################################
  cmM <- confusionMatrix(class_MAUTHS)
  cm1880MAUTHS[[g]] <- as.data.frame(cmM$table) %>%
    mutate(sample = g)
  
  cmF <- confusionMatrix(class_FAUTHS)
  cm1880FAUTHS[[g]] <- as.data.frame(cmF$table) %>%
    mutate(sample = g)
  
  ##Tabulate Precision and Recall
  ##################################################################
  prec1880FAUTHS[[g]] <- precision(cmF$table)
  recall1880FAUTHS[[g]] <- recall(cmF$table)
  prec1880MAUTHS[[g]] <- precision(cmM$table)
  recall1880MAUTHS[[g]] <- recall(cmM$table)
  
  sens1880FAUTHS[[g]] <- sensitivity(cmF$table)
  spec1880FAUTHS[[g]]<- specificity(cmF$table)
  sens1880MAUTHS[[g]] <- sensitivity(cmM$table)
  spec1880MAUTHS[[g]]<- specificity(cmM$table)
  
  negpred1880FAUTHS[[g]] <-negPredValue(cmF$table)
  negpred1880MAUTHS[[g]] <-negPredValue(cmM$table)
  
  ##Create a model on the 1890s
  ##################################################################
  ##################################################################
  classingMAUTHS <- test_allData %>%
    filter(auth_gender %in% "M", pub_decade %in% 1890) %>%
    ungroup() %>%
    select(-one_of("file_name","pub_decade","auth_gender")) %>%
    rename(Class = gender)
  
  justMAUTHS <- classingMAUTHS %>%
    select(-one_of("Class"))
  
  down_MAUTHS <- downSample(x=justMAUTHS, y=as.factor(classingMAUTHS$Class))
  
  classingFAUTHS <- test_allData %>%
    filter(auth_gender %in% "F", pub_decade %in% 1890) %>%
    ungroup() %>% 
    select(-one_of("file_name","pub_decade", "auth_gender")) %>% 
    rename(Class = gender)
  
  justFAUTHS <- classingFAUTHS %>%
    select(-one_of("Class"))
  
  down_FAUTHS <- downSample(x=justFAUTHS, y=as.factor(classingFAUTHS$Class))
  
  ctrl <- trainControl(method = "repeatedcv", repeats = 5, classProbs = TRUE)
  
  set.seed(1996)
  
  class_MAUTHS <- train(Class ~ ., data = down_MAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  class_FAUTHS <- train(Class ~ ., data = down_FAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  
  ##Tabulate Accuracies
  ##################################################################
  M1890ACC[[g]] <- class_MAUTHS$results$Accuracy[1]
  F1890ACC[[g]] <- class_FAUTHS$results$Accuracy[1]
  
  ##Grab Confusion Matrix, Transform to DataFrame
  ##################################################################
  cmM <- confusionMatrix(class_MAUTHS)
  cm1890MAUTHS[[g]] <- as.data.frame(cmM$table) %>%
    mutate(sample = g)
  
  cmF <- confusionMatrix(class_FAUTHS)
  cm1890FAUTHS[[g]] <- as.data.frame(cmF$table) %>%
    mutate(sample = g)
  
  ##Tabulate Precision and Recall
  ##################################################################
  prec1890FAUTHS[[g]] <- precision(cmF$table)
  recall1890FAUTHS[[g]] <- recall(cmF$table)
  prec1890MAUTHS[[g]] <- precision(cmM$table)
  recall1890MAUTHS[[g]] <- recall(cmM$table)
  
  sens1890FAUTHS[[g]] <- sensitivity(cmF$table)
  spec1890FAUTHS[[g]]<- specificity(cmF$table)
  sens1890MAUTHS[[g]] <- sensitivity(cmM$table)
  spec1890MAUTHS[[g]]<- specificity(cmM$table)
  
  negpred1890FAUTHS[[g]] <-negPredValue(cmF$table)
  negpred1890MAUTHS[[g]] <-negPredValue(cmM$table)
  
  ##Create a model on the 1900
  ##################################################################
  ##################################################################
  classingMAUTHS <- test_allData %>%
    filter(auth_gender %in% "M", pub_decade %in% 1900) %>%
    ungroup() %>%
    select(-one_of("file_name","pub_decade","auth_gender")) %>%
    rename(Class = gender)
  
  justMAUTHS <- classingMAUTHS %>%
    select(-one_of("Class"))
  
  down_MAUTHS <- downSample(x=justMAUTHS, y=as.factor(classingMAUTHS$Class))
  
  classingFAUTHS <- test_allData %>%
    filter(auth_gender %in% "F", pub_decade %in% 1900) %>%
    ungroup() %>% 
    select(-one_of("file_name","pub_decade", "auth_gender")) %>% 
    rename(Class = gender)
  
  justFAUTHS <- classingFAUTHS %>%
    select(-one_of("Class"))
  
  down_FAUTHS <- downSample(x=justFAUTHS, y=as.factor(classingFAUTHS$Class))
  
  ctrl <- trainControl(method = "repeatedcv", repeats = 5, classProbs = TRUE)
  
  set.seed(1996)
  
  class_MAUTHS <- train(Class ~ ., data = down_MAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  class_FAUTHS <- train(Class ~ ., data = down_FAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  
  ##Tabulate Accuracies
  ##################################################################
  M1900ACC[[g]] <- class_MAUTHS$results$Accuracy[1]
  F1900ACC[[g]] <- class_FAUTHS$results$Accuracy[1]
  
  ##Grab Confusion Matrix, Transform to DataFrame
  ##################################################################
  cmM <- confusionMatrix(class_MAUTHS)
  cm1900MAUTHS[[g]] <- as.data.frame(cmM$table) %>%
    mutate(sample = g)
  
  cmF <- confusionMatrix(class_FAUTHS)
  cm1900FAUTHS[[g]] <- as.data.frame(cmF$table) %>%
    mutate(sample = g)
  
  ##Tabulate Precision and Recall
  ##################################################################
  prec1900FAUTHS[[g]] <- precision(cmF$table)
  recall1900FAUTHS[[g]] <- recall(cmF$table)
  prec1900MAUTHS[[g]] <- precision(cmM$table)
  recall1900MAUTHS[[g]] <- recall(cmM$table)
  
  sens1900FAUTHS[[g]] <- sensitivity(cmF$table)
  spec1900FAUTHS[[g]]<- specificity(cmF$table)
  sens1900MAUTHS[[g]] <- sensitivity(cmM$table)
  spec1900MAUTHS[[g]]<- specificity(cmM$table)
  
  negpred1900FAUTHS[[g]] <-negPredValue(cmF$table)
  negpred1900MAUTHS[[g]] <-negPredValue(cmM$table)
  
  ##Create a model on the 1910
  ##################################################################
  ##################################################################
  classingMAUTHS <- test_allData %>%
    filter(auth_gender %in% "M", pub_decade %in% 1910) %>%
    ungroup() %>%
    select(-one_of("file_name","pub_decade","auth_gender")) %>%
    rename(Class = gender)
  
  justMAUTHS <- classingMAUTHS %>%
    select(-one_of("Class"))
  
  down_MAUTHS <- downSample(x=justMAUTHS, y=as.factor(classingMAUTHS$Class))
  
  classingFAUTHS <- test_allData %>%
    filter(auth_gender %in% "F", pub_decade %in% 1910) %>%
    ungroup() %>% 
    select(-one_of("file_name","pub_decade", "auth_gender")) %>% 
    rename(Class = gender)
  
  justFAUTHS <- classingFAUTHS %>%
    select(-one_of("Class"))
  
  down_FAUTHS <- downSample(x=justFAUTHS, y=as.factor(classingFAUTHS$Class))
  
  ctrl <- trainControl(method = "repeatedcv", repeats = 5, classProbs = TRUE)
  
  set.seed(1996)
  
  class_MAUTHS <- train(Class ~ ., data = down_MAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  class_FAUTHS <- train(Class ~ ., data = down_FAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  ##Tabulate Accuracies
  ##################################################################
  M1910ACC[[g]] <- class_MAUTHS$results$Accuracy[1]
  F1910ACC[[g]] <- class_FAUTHS$results$Accuracy[1]
  
  ##Grab Confusion Matrix, Transform to DataFrame
  ##################################################################
  cmM <- confusionMatrix(class_MAUTHS)
  cm1910MAUTHS[[g]] <- as.data.frame(cmM$table) %>%
    mutate(sample = g)
  
  cmF <- confusionMatrix(class_FAUTHS)
  cm1910FAUTHS[[g]] <- as.data.frame(cmF$table) %>%
    mutate(sample = g)
  
  ##Tabulate Precision and Recall
  ##################################################################
  prec1910FAUTHS[[g]] <- precision(cmF$table)
  recall1910FAUTHS[[g]] <- recall(cmF$table)
  prec1910MAUTHS[[g]] <- precision(cmM$table)
  recall1910MAUTHS[[g]] <- recall(cmM$table)
  
  sens1910FAUTHS[[g]] <- sensitivity(cmF$table)
  spec1910FAUTHS[[g]]<- specificity(cmF$table)
  sens1910MAUTHS[[g]] <- sensitivity(cmM$table)
  spec1910MAUTHS[[g]]<- specificity(cmM$table)
  
  negpred1910FAUTHS[[g]] <-negPredValue(cmF$table)
  negpred1910MAUTHS[[g]] <-negPredValue(cmM$table)
  
  ##Create a model on the 1920
  ##################################################################
  ##################################################################
  classingMAUTHS <- test_allData %>%
    filter(auth_gender %in% "M", pub_decade %in% 1920) %>%
    ungroup() %>%
    select(-one_of("file_name","pub_decade","auth_gender")) %>%
    rename(Class = gender)
  
  justMAUTHS <- classingMAUTHS %>%
    select(-one_of("Class"))
  
  down_MAUTHS <- downSample(x=justMAUTHS, y=as.factor(classingMAUTHS$Class))
  
  classingFAUTHS <- test_allData %>%
    filter(auth_gender %in% "F", pub_decade %in% 1920) %>%
    ungroup() %>% 
    select(-one_of("file_name","pub_decade", "auth_gender")) %>% 
    rename(Class = gender)
  
  justFAUTHS <- classingFAUTHS %>%
    select(-one_of("Class"))
  
  down_FAUTHS <- downSample(x=justFAUTHS, y=as.factor(classingFAUTHS$Class))
  
  ctrl <- trainControl(method = "repeatedcv", repeats = 5, classProbs = TRUE)
  
  set.seed(1996)
  
  class_MAUTHS <- train(Class ~ ., data = down_MAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  class_FAUTHS <- train(Class ~ ., data = down_FAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  
  ##Tabulate Accuracies
  ##################################################################
  M1920ACC[[g]] <- class_MAUTHS$results$Accuracy[1]
  F1920ACC[[g]] <- class_FAUTHS$results$Accuracy[1]
  
  ##Grab Confusion Matrix, Transform to DataFrame
  ##################################################################
  cmM <- confusionMatrix(class_MAUTHS)
  cm1920MAUTHS[[g]] <- as.data.frame(cmM$table) %>%
    mutate(sample = g)
  
  cmF <- confusionMatrix(class_FAUTHS)
  cm1920FAUTHS[[g]] <- as.data.frame(cmF$table) %>%
    mutate(sample = g)
  
  ##Tabulate Precision and Recall
  ##################################################################
  prec1920FAUTHS[[g]] <- precision(cmF$table)
  recall1920FAUTHS[[g]] <- recall(cmF$table)
  prec1920MAUTHS[[g]] <- precision(cmM$table)
  recall1920MAUTHS[[g]] <- recall(cmM$table)
  
  sens1920FAUTHS[[g]] <- sensitivity(cmF$table)
  spec1920FAUTHS[[g]]<- specificity(cmF$table)
  sens1920MAUTHS[[g]] <- sensitivity(cmM$table)
  spec1920MAUTHS[[g]]<- specificity(cmM$table)
  
  negpred1920FAUTHS[[g]] <-negPredValue(cmF$table)
  negpred1920MAUTHS[[g]] <-negPredValue(cmM$table)
  
  ##Create a model on the 1930
  ##################################################################
  ##################################################################
  classingMAUTHS <- test_allData %>%
    filter(auth_gender %in% "M", pub_decade %in% 1930) %>%
    ungroup() %>%
    select(-one_of("file_name","pub_decade","auth_gender")) %>%
    rename(Class = gender)
  
  justMAUTHS <- classingMAUTHS %>%
    select(-one_of("Class"))
  
  down_MAUTHS <- downSample(x=justMAUTHS, y=as.factor(classingMAUTHS$Class))
  
  classingFAUTHS <- test_allData %>%
    filter(auth_gender %in% "F", pub_decade %in% 1930) %>%
    ungroup() %>% 
    select(-one_of("file_name","pub_decade", "auth_gender")) %>% 
    rename(Class = gender)
  
  justFAUTHS <- classingFAUTHS %>%
    select(-one_of("Class"))
  
  down_FAUTHS <- downSample(x=justFAUTHS, y=as.factor(classingFAUTHS$Class))
  
  ctrl <- trainControl(method = "repeatedcv", repeats = 5, classProbs = TRUE)
  
  set.seed(1996)
  
  class_MAUTHS <- train(Class ~ ., data = down_MAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  class_FAUTHS <- train(Class ~ ., data = down_FAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  
  ##Tabulate Accuracies
  ##################################################################
  M1930ACC[[g]] <- class_MAUTHS$results$Accuracy[1]
  F1930ACC[[g]] <- class_FAUTHS$results$Accuracy[1]
  
  ##Grab Confusion Matrix, Transform to DataFrame
  ##################################################################
  cmM <- confusionMatrix(class_MAUTHS)
  cm1930MAUTHS[[g]] <- as.data.frame(cmM$table) %>%
    mutate(sample = g)
  
  cmF <- confusionMatrix(class_FAUTHS)
  cm1930FAUTHS[[g]] <- as.data.frame(cmF$table) %>%
    mutate(sample = g)
  
  ##Tabulate Precision and Recall
  ##################################################################
  prec1930FAUTHS[[g]] <- precision(cmF$table)
  recall1930FAUTHS[[g]] <- recall(cmF$table)
  prec1930MAUTHS[[g]] <- precision(cmM$table)
  recall1930MAUTHS[[g]] <- recall(cmM$table)
  
  sens1930FAUTHS[[g]] <- sensitivity(cmF$table)
  spec1930FAUTHS[[g]]<- specificity(cmF$table)
  sens1930MAUTHS[[g]] <- sensitivity(cmM$table)
  spec1930MAUTHS[[g]]<- specificity(cmM$table)
  
  negpred1930FAUTHS[[g]] <-negPredValue(cmF$table)
  negpred1930MAUTHS[[g]] <-negPredValue(cmM$table)
  
  ##Create a model on the 1940
  ##################################################################
  ##################################################################
  classingMAUTHS <- test_allData %>%
    filter(auth_gender %in% "M", pub_decade %in% 1940) %>%
    ungroup() %>%
    select(-one_of("file_name","pub_decade","auth_gender")) %>%
    rename(Class = gender)
  
  justMAUTHS <- classingMAUTHS %>%
    select(-one_of("Class"))
  
  down_MAUTHS <- downSample(x=justMAUTHS, y=as.factor(classingMAUTHS$Class))
  
  classingFAUTHS <- test_allData %>%
    filter(auth_gender %in% "F", pub_decade %in% 1940) %>%
    ungroup() %>% 
    select(-one_of("file_name","pub_decade", "auth_gender")) %>% 
    rename(Class = gender)
  
  justFAUTHS <- classingFAUTHS %>%
    select(-one_of("Class"))
  
  down_FAUTHS <- downSample(x=justFAUTHS, y=as.factor(classingFAUTHS$Class))
  
  ctrl <- trainControl(method = "repeatedcv", repeats = 5, classProbs = TRUE)
  
  set.seed(1996)
  
  class_MAUTHS <- train(Class ~ ., data = down_MAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  class_FAUTHS <- train(Class ~ ., data = down_FAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  
  ##Tabulate Accuracies
  ##################################################################
  M1940ACC[[g]] <- class_MAUTHS$results$Accuracy[1]
  F1940ACC[[g]] <- class_FAUTHS$results$Accuracy[1]
  
  ##Grab Confusion Matrix, Transform to DataFrame
  ##################################################################
  cmM <- confusionMatrix(class_MAUTHS)
  cm1940MAUTHS[[g]] <- as.data.frame(cmM$table) %>%
    mutate(sample = g)
  
  cmF <- confusionMatrix(class_FAUTHS)
  cm1940FAUTHS[[g]] <- as.data.frame(cmF$table) %>%
    mutate(sample = g)
  
  ##Tabulate Precision and Recall
  ##################################################################
  prec1940FAUTHS[[g]] <- precision(cmF$table)
  recall1940FAUTHS[[g]] <- recall(cmF$table)
  prec1940MAUTHS[[g]] <- precision(cmM$table)
  recall1940MAUTHS[[g]] <- recall(cmM$table)
  
  sens1940FAUTHS[[g]] <- sensitivity(cmF$table)
  spec1940FAUTHS[[g]]<- specificity(cmF$table)
  sens1940MAUTHS[[g]] <- sensitivity(cmM$table)
  spec1940MAUTHS[[g]]<- specificity(cmM$table)
  
  negpred1940FAUTHS[[g]] <-negPredValue(cmF$table)
  negpred1940MAUTHS[[g]] <-negPredValue(cmM$table)
  ##Create a model on the 1950
  ##################################################################
  ##################################################################
  classingMAUTHS <- test_allData %>%
    filter(auth_gender %in% "M", pub_decade %in% 1950) %>%
    ungroup() %>%
    select(-one_of("file_name","pub_decade","auth_gender")) %>%
    rename(Class = gender)
  
  justMAUTHS <- classingMAUTHS %>%
    select(-one_of("Class"))
  
  down_MAUTHS <- downSample(x=justMAUTHS, y=as.factor(classingMAUTHS$Class))
  
  classingFAUTHS <- test_allData %>%
    filter(auth_gender %in% "F", pub_decade %in% 1950) %>%
    ungroup() %>% 
    select(-one_of("file_name","pub_decade", "auth_gender")) %>% 
    rename(Class = gender)
  
  justFAUTHS <- classingFAUTHS %>%
    select(-one_of("Class"))
  
  down_FAUTHS <- downSample(x=justFAUTHS, y=as.factor(classingFAUTHS$Class))
  
  ctrl <- trainControl(method = "repeatedcv", repeats = 5, classProbs = TRUE)
  
  set.seed(1996)
  
  class_MAUTHS <- train(Class ~ ., data = down_MAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  class_FAUTHS <- train(Class ~ ., data = down_FAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  
  ##Tabulate Accuracies
  ##################################################################
  M1950ACC[[g]] <- class_MAUTHS$results$Accuracy[1]
  F1950ACC[[g]] <- class_FAUTHS$results$Accuracy[1]
  
  ##Grab Confusion Matrix, Transform to DataFrame
  ##################################################################
  cmM <- confusionMatrix(class_MAUTHS)
  cm1950MAUTHS[[g]] <- as.data.frame(cmM$table) %>%
    mutate(sample = g)
  
  cmF <- confusionMatrix(class_FAUTHS)
  cm1950FAUTHS[[g]] <- as.data.frame(cmF$table) %>%
    mutate(sample = g)
  
  ##Tabulate Precision and Recall
  ##################################################################
  prec1950FAUTHS[[g]] <- precision(cmF$table)
  recall1950FAUTHS[[g]] <- recall(cmF$table)
  prec1950MAUTHS[[g]] <- precision(cmM$table)
  recall1950MAUTHS[[g]] <- recall(cmM$table)
  
  sens1950FAUTHS[[g]] <- sensitivity(cmF$table)
  spec1950FAUTHS[[g]]<- specificity(cmF$table)
  sens1950MAUTHS[[g]] <- sensitivity(cmM$table)
  spec1950MAUTHS[[g]]<- specificity(cmM$table)
  
  negpred1950FAUTHS[[g]] <-negPredValue(cmF$table)
  negpred1950MAUTHS[[g]] <-negPredValue(cmM$table)
  
  ##Create a model on the 1960
  ##################################################################
  ##################################################################
  classingMAUTHS <- test_allData %>%
    filter(auth_gender %in% "M", pub_decade %in% 1960) %>%
    ungroup() %>%
    select(-one_of("file_name","pub_decade","auth_gender")) %>%
    rename(Class = gender)
  
  justMAUTHS <- classingMAUTHS %>%
    select(-one_of("Class"))
  
  down_MAUTHS <- downSample(x=justMAUTHS, y=as.factor(classingMAUTHS$Class))
  
  classingFAUTHS <- test_allData %>%
    filter(auth_gender %in% "F", pub_decade %in% 1960) %>%
    ungroup() %>% 
    select(-one_of("file_name","pub_decade", "auth_gender")) %>% 
    rename(Class = gender)
  
  justFAUTHS <- classingFAUTHS %>%
    select(-one_of("Class"))
  
  down_FAUTHS <- downSample(x=justFAUTHS, y=as.factor(classingFAUTHS$Class))
  
  ctrl <- trainControl(method = "repeatedcv", repeats = 5, classProbs = TRUE)
  
  set.seed(1996)
  
  class_MAUTHS <- train(Class ~ ., data = down_MAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  class_FAUTHS <- train(Class ~ ., data = down_FAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  
  ##Tabulate Accuracies
  ##################################################################
  M1960ACC[[g]] <- class_MAUTHS$results$Accuracy[1]
  F1960ACC[[g]] <- class_FAUTHS$results$Accuracy[1]
  
  ##Grab Confusion Matrix, Transform to DataFrame
  ##################################################################
  cmM <- confusionMatrix(class_MAUTHS)
  cm1960MAUTHS[[g]] <- as.data.frame(cmM$table) %>%
    mutate(sample = g)
  
  cmF <- confusionMatrix(class_FAUTHS)
  cm1960FAUTHS[[g]] <- as.data.frame(cmF$table) %>%
    mutate(sample = g)
  
  ##Tabulate Precision and Recall
  ##################################################################
  prec1960FAUTHS[[g]] <- precision(cmF$table)
  recall1960FAUTHS[[g]] <- recall(cmF$table)
  prec1960MAUTHS[[g]] <- precision(cmM$table)
  recall1960MAUTHS[[g]] <- recall(cmM$table)
  
  sens1960FAUTHS[[g]] <- sensitivity(cmF$table)
  spec1960FAUTHS[[g]]<- specificity(cmF$table)
  sens1960MAUTHS[[g]] <- sensitivity(cmM$table)
  spec1960MAUTHS[[g]]<- specificity(cmM$table)
  
  negpred1960FAUTHS[[g]] <-negPredValue(cmF$table)
  negpred1960MAUTHS[[g]] <-negPredValue(cmM$table)
  
  ##Create a model on the 1970
  ##################################################################
  ##################################################################
  classingMAUTHS <- test_allData %>%
    filter(auth_gender %in% "M", pub_decade %in% 1970) %>%
    ungroup() %>%
    select(-one_of("file_name","pub_decade","auth_gender")) %>%
    rename(Class = gender)
  
  justMAUTHS <- classingMAUTHS %>%
    select(-one_of("Class"))
  
  down_MAUTHS <- downSample(x=justMAUTHS, y=as.factor(classingMAUTHS$Class))
  
  classingFAUTHS <- test_allData %>%
    filter(auth_gender %in% "F", pub_decade %in% 1970) %>%
    ungroup() %>% 
    select(-one_of("file_name","pub_decade", "auth_gender")) %>% 
    rename(Class = gender)
  
  justFAUTHS <- classingFAUTHS %>%
    select(-one_of("Class"))
  
  down_FAUTHS <- downSample(x=justFAUTHS, y=as.factor(classingFAUTHS$Class))
  
  ctrl <- trainControl(method = "repeatedcv", repeats = 5, classProbs = TRUE)
  
  set.seed(1996)
  
  class_MAUTHS <- train(Class ~ ., data = down_MAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  class_FAUTHS <- train(Class ~ ., data = down_FAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  
  ##Tabulate Accuracies
  ##################################################################
  M1970ACC[[g]] <- class_MAUTHS$results$Accuracy[1]
  F1970ACC[[g]] <- class_FAUTHS$results$Accuracy[1]
  
  ##Grab Confusion Matrix, Transform to DataFrame
  ##################################################################
  cmM <- confusionMatrix(class_MAUTHS)
  cm1970MAUTHS[[g]] <- as.data.frame(cmM$table) %>%
    mutate(sample = g)
  
  cmF <- confusionMatrix(class_FAUTHS)
  cm1970FAUTHS[[g]] <- as.data.frame(cmF$table) %>%
    mutate(sample = g)
  
  ##Tabulate Precision and Recall
  ##################################################################
  prec1970FAUTHS[[g]] <- precision(cmF$table)
  recall1970FAUTHS[[g]] <- recall(cmF$table)
  prec1970MAUTHS[[g]] <- precision(cmM$table)
  recall1970MAUTHS[[g]] <- recall(cmM$table)
  
  sens1970FAUTHS[[g]] <- sensitivity(cmF$table)
  spec1970FAUTHS[[g]]<- specificity(cmF$table)
  sens1970MAUTHS[[g]] <- sensitivity(cmM$table)
  spec1970MAUTHS[[g]]<- specificity(cmM$table)
  
  negpred1970FAUTHS[[g]] <-negPredValue(cmF$table)
  negpred1970MAUTHS[[g]] <-negPredValue(cmM$table)
  
  ##Create a model on the 1980
  ##################################################################
  ##################################################################
  classingMAUTHS <- test_allData %>%
    filter(auth_gender %in% "M", pub_decade %in% 1980) %>%
    ungroup() %>%
    select(-one_of("file_name","pub_decade","auth_gender")) %>%
    rename(Class = gender)
  
  justMAUTHS <- classingMAUTHS %>%
    select(-one_of("Class"))
  
  down_MAUTHS <- downSample(x=justMAUTHS, y=as.factor(classingMAUTHS$Class))
  
  classingFAUTHS <- test_allData %>%
    filter(auth_gender %in% "F", pub_decade %in% 1980) %>%
    ungroup() %>% 
    select(-one_of("file_name","pub_decade", "auth_gender")) %>% 
    rename(Class = gender)
  
  justFAUTHS <- classingFAUTHS %>%
    select(-one_of("Class"))
  
  down_FAUTHS <- downSample(x=justFAUTHS, y=as.factor(classingFAUTHS$Class))
  
  ctrl <- trainControl(method = "repeatedcv", repeats = 5, classProbs = TRUE)
  
  set.seed(1996)
  
  class_MAUTHS <- train(Class ~ ., data = down_MAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  class_FAUTHS <- train(Class ~ ., data = down_FAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  
  ##Tabulate Accuracies
  ##################################################################
  M1980ACC[[g]] <- class_MAUTHS$results$Accuracy[1]
  F1980ACC[[g]] <- class_FAUTHS$results$Accuracy[1]
  
  ##Grab Confusion Matrix, Transform to DataFrame
  ##################################################################
  cmM <- confusionMatrix(class_MAUTHS)
  cm1980MAUTHS[[g]] <- as.data.frame(cmM$table) %>%
    mutate(sample = g)
  
  cmF <- confusionMatrix(class_FAUTHS)
  cm1980FAUTHS[[g]] <- as.data.frame(cmF$table) %>%
    mutate(sample = g)
  
  ##Tabulate Precision and Recall
  ##################################################################
  prec1980FAUTHS[[g]] <- precision(cmF$table)
  recall1980FAUTHS[[g]] <- recall(cmF$table)
  prec1980MAUTHS[[g]] <- precision(cmM$table)
  recall1980MAUTHS[[g]] <- recall(cmM$table)
  
  sens1980FAUTHS[[g]] <- sensitivity(cmF$table)
  spec1980FAUTHS[[g]]<- specificity(cmF$table)
  sens1980MAUTHS[[g]] <- sensitivity(cmM$table)
  spec1980MAUTHS[[g]]<- specificity(cmM$table)
  
  negpred1980FAUTHS[[g]] <-negPredValue(cmF$table)
  negpred1980MAUTHS[[g]] <-negPredValue(cmM$table)
  
  ##Create a model on the 1990
  ##################################################################
  ##################################################################
  classingMAUTHS <- test_allData %>%
    filter(auth_gender %in% "M", pub_decade %in% 1990) %>%
    ungroup() %>%
    select(-one_of("file_name","pub_decade","auth_gender")) %>%
    rename(Class = gender)
  
  justMAUTHS <- classingMAUTHS %>%
    select(-one_of("Class"))
  
  down_MAUTHS <- downSample(x=justMAUTHS, y=as.factor(classingMAUTHS$Class))
  
  classingFAUTHS <- test_allData %>%
    filter(auth_gender %in% "F", pub_decade %in% 1990) %>%
    ungroup() %>% 
    select(-one_of("file_name","pub_decade", "auth_gender")) %>% 
    rename(Class = gender)
  
  justFAUTHS <- classingFAUTHS %>%
    select(-one_of("Class"))
  
  down_FAUTHS <- downSample(x=justFAUTHS, y=as.factor(classingFAUTHS$Class))
  
  ctrl <- trainControl(method = "repeatedcv", repeats = 5, classProbs = TRUE)
  
  set.seed(1996)
  
  class_MAUTHS <- train(Class ~ ., data = down_MAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  class_FAUTHS <- train(Class ~ ., data = down_FAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  
  ##Tabulate Accuracies
  ##################################################################
  M1990ACC[[g]] <- class_MAUTHS$results$Accuracy[1]
  F1990ACC[[g]] <- class_FAUTHS$results$Accuracy[1]
  
  ##Grab Confusion Matrix, Transform to DataFrame
  ##################################################################
  cmM <- confusionMatrix(class_MAUTHS)
  cm1990MAUTHS[[g]] <- as.data.frame(cmM$table) %>%
    mutate(sample = g)
  
  cmF <- confusionMatrix(class_FAUTHS)
  cm1990FAUTHS[[g]] <- as.data.frame(cmF$table) %>%
    mutate(sample = g)
  
  ##Tabulate Precision and Recall
  ##################################################################
  prec1990FAUTHS[[g]] <- precision(cmF$table)
  recall1990FAUTHS[[g]] <- recall(cmF$table)
  prec1990MAUTHS[[g]] <- precision(cmM$table)
  recall1990MAUTHS[[g]] <- recall(cmM$table)
  
  sens1990FAUTHS[[g]] <- sensitivity(cmF$table)
  spec1990FAUTHS[[g]]<- specificity(cmF$table)
  sens1990MAUTHS[[g]] <- sensitivity(cmM$table)
  spec1990MAUTHS[[g]]<- specificity(cmM$table)
  
  negpred1990FAUTHS[[g]] <-negPredValue(cmF$table)
  negpred1990MAUTHS[[g]] <-negPredValue(cmM$table)
  
  ##Create a model on the 2000
  ##################################################################
  ##################################################################
  classingMAUTHS <- test_allData %>%
    filter(auth_gender %in% "M", pub_decade %in% 2000) %>%
    ungroup() %>%
    select(-one_of("file_name","pub_decade","auth_gender")) %>%
    rename(Class = gender)
  
  justMAUTHS <- classingMAUTHS %>%
    select(-one_of("Class"))
  
  down_MAUTHS <- downSample(x=justMAUTHS, y=as.factor(classingMAUTHS$Class))
  
  classingFAUTHS <- test_allData %>%
    filter(auth_gender %in% "F", pub_decade %in% 2000) %>%
    ungroup() %>% 
    select(-one_of("file_name","pub_decade", "auth_gender")) %>% 
    rename(Class = gender)
  
  justFAUTHS <- classingFAUTHS %>%
    select(-one_of("Class"))
  
  down_FAUTHS <- downSample(x=justFAUTHS, y=as.factor(classingFAUTHS$Class))
  
  ctrl <- trainControl(method = "repeatedcv", repeats = 5, classProbs = TRUE)
  
  set.seed(1996)
  
  class_MAUTHS <- train(Class ~ ., data = down_MAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  class_FAUTHS <- train(Class ~ ., data = down_FAUTHS, 
                        method = "pam", 
                        preProcess = c("center","scale"), 
                        trControl = ctrl)
  
  
  ##Tabulate Accuracies
  ##################################################################
  M2000ACC[[g]] <- class_MAUTHS$results$Accuracy[1]
  F2000ACC[[g]] <- class_FAUTHS$results$Accuracy[1]
  
  ##Grab Confusion Matrix, Transform to DataFrame
  ##################################################################
  cmM <- confusionMatrix(class_MAUTHS)
  cm2000MAUTHS[[g]] <- as.data.frame(cmM$table) %>%
    mutate(sample = g)
  
  cmF <- confusionMatrix(class_FAUTHS)
  cm2000FAUTHS[[g]] <- as.data.frame(cmF$table) %>%
    mutate(sample = g)
  
  ##Tabulate Precision and Recall
  ##################################################################
  prec2000FAUTHS[[g]] <- precision(cmF$table)
  recall2000FAUTHS[[g]] <- recall(cmF$table)
  prec2000MAUTHS[[g]] <- precision(cmM$table)
  recall2000MAUTHS[[g]] <- recall(cmM$table)
  
  sens2000FAUTHS[[g]] <- sensitivity(cmF$table)
  spec2000FAUTHS[[g]]<- specificity(cmF$table)
  sens2000MAUTHS[[g]] <- sensitivity(cmM$table)
  spec2000MAUTHS[[g]]<- specificity(cmM$table)
  
  negpred2000FAUTHS[[g]] <-negPredValue(cmF$table)
  negpred2000MAUTHS[[g]] <-negPredValue(cmM$table)
}


#Bind Lists of Data Frames
##################################################################
##################################################################
mauth_ACC <- as.data.frame(MtotalACC)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")
mauth_PREC <- as.data.frame(precMAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")
mauth_RECALL <- as.data.frame(recallMAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")
fauth_ACC <- as.data.frame(FtotalACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")
fauth_PREC <- as.data.frame(precFAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")
fauth_RECALL <- as.data.frame(recallFAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")
m_CM <- bind_rows(cmMAUTHS)
f_CM <- bind_rows(cmFAUTHS)
mauth_SENS <- as.data.frame(sensMAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "M")
mauth_SPEC <- as.data.frame(specMAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "M")
fauth_SENS <- as.data.frame(sensFAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "F")
fauth_SPEC <- as.data.frame(specFAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "F")
fauth_NEGPRED <- as.data.frame(negpredFAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "F")
mauth_NEGPRED <- as.data.frame(negpredMAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "M")

mauth1850_ACC <- as.data.frame(M1850ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1850")
mauth1850_PREC <- as.data.frame(prec1850MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1850")
mauth1850_RECALL <- as.data.frame(recall1850MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1850")
fauth1850_ACC <- as.data.frame(F1850ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1850")
fauth1850_PREC <- as.data.frame(prec1850FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1850")
fauth1850_RECALL <- as.data.frame(recall1850FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1850")
m1850_CM <- bind_rows(cm1850MAUTHS) %>%
  mutate(pub_decade = "1850")
f1850_CM <- bind_rows(cm1850FAUTHS) %>%
  mutate(pub_decade = "1850")
mauth1850_SENS <- as.data.frame(sens1850MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1850")
mauth1850_SPEC <- as.data.frame(spec1850MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1850")
fauth1850_SENS <- as.data.frame(sens1850FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1850")
fauth1850_SPEC <- as.data.frame(spec1850FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1850")
fauth1850_NEGPRED <- as.data.frame(negpred1850FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1850")
mauth1850_NEGPRED <- as.data.frame(negpred1850MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1850")

mauth1860_ACC <- as.data.frame(M1860ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1860")
mauth1860_PREC <- as.data.frame(prec1860MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1860")
mauth1860_RECALL <- as.data.frame(recall1860MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1860")
fauth1860_ACC <- as.data.frame(F1860ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1860")
fauth1860_PREC <- as.data.frame(prec1860FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1860")
fauth1860_RECALL <- as.data.frame(recall1860FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1860")
m1860_CM <- bind_rows(cm1860MAUTHS) %>%
  mutate(pub_decade = "1860")
f1860_CM <- bind_rows(cm1860FAUTHS) %>%
  mutate(pub_decade = "1860")
mauth1860_SENS <- as.data.frame(sens1860MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1860")
mauth1860_SPEC <- as.data.frame(spec1860MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1860")
fauth1860_SENS <- as.data.frame(sens1860FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1860")
fauth1860_SPEC <- as.data.frame(spec1860FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1860")
fauth1860_NEGPRED <- as.data.frame(negpred1860FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1860")
mauth1860_NEGPRED <- as.data.frame(negpred1860MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1860")

mauth1870_ACC <- as.data.frame(M1870ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1870")
mauth1870_PREC <- as.data.frame(prec1870MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1870")
mauth1870_RECALL <- as.data.frame(recall1870MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1870")
fauth1870_ACC <- as.data.frame(F1870ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1870")
fauth1870_PREC <- as.data.frame(prec1870FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1870")
fauth1870_RECALL <- as.data.frame(recall1870FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1870")
m1870_CM <- bind_rows(cm1870MAUTHS) %>%
  mutate(pub_decade = "1870")
f1870_CM <- bind_rows(cm1870FAUTHS) %>%
  mutate(pub_decade = "1870")
mauth1870_SENS <- as.data.frame(sens1870MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1870")
mauth1870_SPEC <- as.data.frame(spec1870MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1870")
fauth1870_SENS <- as.data.frame(sens1870FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1870")
fauth1870_SPEC <- as.data.frame(spec1870FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1870")
fauth1870_NEGPRED <- as.data.frame(negpred1870FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1870")
mauth1870_NEGPRED <- as.data.frame(negpred1870MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1870")

mauth1880_ACC <- as.data.frame(M1880ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1880")
mauth1880_PREC <- as.data.frame(prec1880MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1880")
mauth1880_RECALL <- as.data.frame(recall1880MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1880")
fauth1880_ACC <- as.data.frame(F1880ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1880")
fauth1880_PREC <- as.data.frame(prec1880FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1880")
fauth1880_RECALL <- as.data.frame(recall1880FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1880")
m1880_CM <- bind_rows(cm1880MAUTHS) %>%
  mutate(pub_decade = "1880")
f1880_CM <- bind_rows(cm1880FAUTHS) %>%
  mutate(pub_decade = "1880")
mauth1880_SENS <- as.data.frame(sens1880MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1880")
mauth1880_SPEC <- as.data.frame(spec1880MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1880")
fauth1880_SENS <- as.data.frame(sens1880FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1880")
fauth1880_SPEC <- as.data.frame(spec1880FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1880")
fauth1880_NEGPRED <- as.data.frame(negpred1880FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1880")
mauth1880_NEGPRED <- as.data.frame(negpred1880MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1880")

mauth1890_ACC <- as.data.frame(M1890ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1890")
mauth1890_PREC <- as.data.frame(prec1890MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1890")
mauth1890_RECALL <- as.data.frame(recall1890MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1890")
fauth1890_ACC <- as.data.frame(F1890ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1890")
fauth1890_PREC <- as.data.frame(prec1890FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1890")
fauth1890_RECALL <- as.data.frame(recall1890FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1890") 
m1890_CM <- bind_rows(cm1890MAUTHS) %>%
  mutate(pub_decade = "1890")
f1890_CM <- bind_rows(cm1890FAUTHS) %>%
  mutate(pub_decade = "1890")
mauth1890_SENS <- as.data.frame(sens1890MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1890")
mauth1890_SPEC <- as.data.frame(spec1890MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1890")
fauth1890_SENS <- as.data.frame(sens1890FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1890")
fauth1890_SPEC <- as.data.frame(spec1890FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1890")
fauth1890_NEGPRED <- as.data.frame(negpred1890FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1890")
mauth1890_NEGPRED <- as.data.frame(negpred1890MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1890")

mauth1900_ACC <- as.data.frame(M1900ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1900")
mauth1900_PREC <- as.data.frame(prec1900MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1900")
mauth1900_RECALL <- as.data.frame(recall1900MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1900")
fauth1900_ACC <- as.data.frame(F1900ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1900")
fauth1900_PREC <- as.data.frame(prec1900FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1900")
fauth1900_RECALL <- as.data.frame(recall1900FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1900") 
m1900_CM <- bind_rows(cm1900MAUTHS) %>%
  mutate(pub_decade = "1900")
f1900_CM <- bind_rows(cm1900FAUTHS) %>%
  mutate(pub_decade = "1900")
mauth1900_SENS <- as.data.frame(sens1900MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1900")
mauth1900_SPEC <- as.data.frame(spec1900MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity= 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1900")
fauth1900_SENS <- as.data.frame(sens1900FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1900")
fauth1900_SPEC <- as.data.frame(spec1900FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1900")
fauth1900_NEGPRED <- as.data.frame(negpred1900FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1900")
mauth1900_NEGPRED <- as.data.frame(negpred1900MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1900")

mauth1910_ACC <- as.data.frame(M1910ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1910")
mauth1910_PREC <- as.data.frame(prec1910MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1910")
mauth1910_RECALL <- as.data.frame(recall1910MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1910")
fauth1910_ACC <- as.data.frame(F1910ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1910")
fauth1910_PREC <- as.data.frame(prec1910FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1910")
fauth1910_RECALL <- as.data.frame(recall1910FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1910") 
m1910_CM <- bind_rows(cm1910MAUTHS) %>%
  mutate(pub_decade = "1910")
f1910_CM <- bind_rows(cm1910FAUTHS) %>%
  mutate(pub_decade = "1910")
mauth1910_SENS <- as.data.frame(sens1910MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1910")
mauth1910_SPEC <- as.data.frame(spec1910MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1910")
fauth1910_SENS <- as.data.frame(sens1910FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1910")
fauth1910_SPEC <- as.data.frame(spec1910FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1910")
fauth1910_NEGPRED <- as.data.frame(negpred1910FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1910")
mauth1910_NEGPRED <- as.data.frame(negpred1910MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1910")

mauth1920_ACC <- as.data.frame(M1920ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1920") 
mauth1920_PREC <- as.data.frame(prec1920MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1920") 
mauth1920_RECALL <- as.data.frame(recall1920MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1920") 
fauth1920_ACC <- as.data.frame(F1920ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1920") 
fauth1920_PREC <- as.data.frame(prec1920FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1920") 
fauth1920_RECALL <- as.data.frame(recall1920FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1920")
m1920_CM <- bind_rows(cm1920MAUTHS)
f1920_CM <- bind_rows(cm1920FAUTHS)
mauth1920_SENS <- as.data.frame(sens1920MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1920")
mauth1920_SPEC <- as.data.frame(spec1920MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1920")
fauth1920_SENS <- as.data.frame(sens1920FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1920")
fauth1920_SPEC <- as.data.frame(spec1920FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1920")
fauth1920_NEGPRED <- as.data.frame(negpred1920FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1920")
mauth1920_NEGPRED <- as.data.frame(negpred1920MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1920")

mauth1930_ACC <- as.data.frame(M1930ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1930") 
mauth1930_PREC <- as.data.frame(prec1930MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1930")
mauth1930_RECALL <- as.data.frame(recall1930MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1930")
fauth1930_ACC <- as.data.frame(F1930ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1930")
fauth1930_PREC <- as.data.frame(prec1930FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1930")
fauth1930_RECALL <- as.data.frame(recall1930FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1930")  
m1930_CM <- bind_rows(cm1930MAUTHS) %>%
  mutate(pub_decade = "1930")
f1930_CM <- bind_rows(cm1930FAUTHS) %>%
  mutate(pub_decade = "1930")
mauth1930_SENS <- as.data.frame(sens1930MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1930")
mauth1930_SPEC <- as.data.frame(spec1930MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1930")
fauth1930_SENS <- as.data.frame(sens1930FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1930")
fauth1930_SPEC <- as.data.frame(spec1930FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1930")
fauth1930_NEGPRED <- as.data.frame(negpred1930FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1930")
mauth1930_NEGPRED <- as.data.frame(negpred1930MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1930")

mauth1940_ACC <- as.data.frame(M1940ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1940")
mauth1940_PREC <- as.data.frame(prec1940MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1940")
mauth1940_RECALL <- as.data.frame(recall1940MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1940")
fauth1940_ACC <- as.data.frame(F1940ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1940")
fauth1940_PREC <- as.data.frame(prec1940FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1940")
fauth1940_RECALL <- as.data.frame(recall1940FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")  %>%
  mutate(pub_decade = "1940")
m1940_CM <- bind_rows(cm1940MAUTHS) %>%
  mutate(pub_decade = "1940")
f1940_CM <- bind_rows(cm1940FAUTHS) %>%
  mutate(pub_decade = "1940")
mauth1940_SENS <- as.data.frame(sens1940MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1940")
mauth1940_SPEC <- as.data.frame(spec1940MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1940")
fauth1940_SENS <- as.data.frame(sens1940FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1940")
fauth1940_SPEC <- as.data.frame(spec1940FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1940")
fauth1940_NEGPRED <- as.data.frame(negpred1940FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1940")
mauth1940_NEGPRED <- as.data.frame(negpred1940MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1940")

mauth1950_ACC <- as.data.frame(M1950ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1950")
mauth1950_PREC <- as.data.frame(prec1950MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1950")
mauth1950_RECALL <- as.data.frame(recall1950MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1950")
fauth1950_ACC <- as.data.frame(F1950ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1950")
fauth1950_PREC <- as.data.frame(prec1950FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1950")
fauth1950_RECALL <- as.data.frame(recall1950FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1950")
m1950_CM <- bind_rows(cm1950MAUTHS) %>%
  mutate(pub_decade = "1950")
f1950_CM <- bind_rows(cm1950FAUTHS) %>%
  mutate(pub_decade = "1950")
mauth1950_SENS <- as.data.frame(sens1950MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1950")
mauth1950_SPEC <- as.data.frame(spec1950MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1950")
fauth1950_SENS <- as.data.frame(sens1950FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1950")
fauth1950_SPEC <- as.data.frame(spec1950FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1950")
fauth1950_NEGPRED <- as.data.frame(negpred1950FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1950")
mauth1950_NEGPRED <- as.data.frame(negpred1950MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1950")

mauth1960_ACC <- as.data.frame(M1960ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1960")
mauth1960_PREC <- as.data.frame(prec1960MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1960")
mauth1960_RECALL <- as.data.frame(recall1960MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1960")
fauth1960_ACC <- as.data.frame(F1960ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1960")
fauth1960_PREC <- as.data.frame(prec1960FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1960")
fauth1960_RECALL <- as.data.frame(recall1960FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1960")  
m1960_CM <- bind_rows(cm1960MAUTHS) %>%
  mutate(pub_decade = "1960")
f1960_CM <- bind_rows(cm1960FAUTHS) %>%
  mutate(pub_decade = "1960")
mauth1960_SENS <- as.data.frame(sens1960MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1960")
mauth1960_SPEC <- as.data.frame(spec1960MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1960")
fauth1960_SENS <- as.data.frame(sens1960FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1960")
fauth1960_SPEC <- as.data.frame(spec1960FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1960")
fauth1960_NEGPRED <- as.data.frame(negpred1960FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1960")
mauth1960_NEGPRED <- as.data.frame(negpred1960MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1960")

mauth1970_ACC <- as.data.frame(M1970ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1970")
mauth1970_PREC <- as.data.frame(prec1970MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1970")
mauth1970_RECALL <- as.data.frame(recall1970MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1970")
fauth1970_ACC <- as.data.frame(F1970ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1970")
fauth1970_PREC <- as.data.frame(prec1970FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1970")
fauth1970_RECALL <- as.data.frame(recall1970FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1970")  
m1970_CM <- bind_rows(cm1970MAUTHS) %>%
  mutate(pub_decade = "1970")
f1970_CM <- bind_rows(cm1970FAUTHS) %>%
  mutate(pub_decade = "1970")
mauth1970_SENS <- as.data.frame(sens1970MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1970")
mauth1970_SPEC <- as.data.frame(spec1970MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1970")
fauth1970_SENS <- as.data.frame(sens1970FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1970")
fauth1970_SPEC <- as.data.frame(spec1970FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1970")
fauth1970_NEGPRED <- as.data.frame(negpred1970FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1970")
mauth1970_NEGPRED <- as.data.frame(negpred1970MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1970")

mauth1980_ACC <- as.data.frame(M1980ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1980")
mauth1980_PREC <- as.data.frame(prec1980MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1980")
mauth1980_RECALL <- as.data.frame(recall1980MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1980")
fauth1980_ACC <- as.data.frame(F1980ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1980")
fauth1980_PREC <- as.data.frame(prec1980FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1980")
fauth1980_RECALL <- as.data.frame(recall1980FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1980")
m1980_CM <- bind_rows(cm1980MAUTHS) %>%
  mutate(pub_decade = "1980")
f1980_CM <- bind_rows(cm1980FAUTHS) %>%
  mutate(pub_decade = "1980")
mauth1980_SENS <- as.data.frame(sens1980MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1980")
mauth1980_SPEC <- as.data.frame(spec1980MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1980")
fauth1980_SENS <- as.data.frame(sens1980FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1980")
fauth1980_SPEC <- as.data.frame(spec1980FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1980")
fauth1980_NEGPRED <- as.data.frame(negpred1980FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1980")
mauth1980_NEGPRED <- as.data.frame(negpred1980MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1980")

mauth1990_ACC <- as.data.frame(M1990ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1990")
mauth1990_PREC <- as.data.frame(prec1990MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1990")
mauth1990_RECALL <- as.data.frame(recall1990MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "1990")
fauth1990_ACC <- as.data.frame(F1990ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1990")
fauth1990_PREC <- as.data.frame(prec1990FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "1990")
fauth1990_RECALL <- as.data.frame(recall1990FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1990") 
m1990_CM <- bind_rows(cm1990MAUTHS) %>%
  mutate(pub_decade = "1990")
f1990_CM <- bind_rows(cm1990FAUTHS) %>%
  mutate(pub_decade = "1990")
mauth1990_SENS <- as.data.frame(sens1990MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1990")
mauth1990_SPEC <- as.data.frame(spec1990MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity  = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1990")
fauth1990_SENS <- as.data.frame(sens1990FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1990")
fauth1990_SPEC <- as.data.frame(spec1990FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1990")
fauth1990_NEGPRED <- as.data.frame(negpred1990FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "1990")
mauth1990_NEGPRED <- as.data.frame(negpred1990MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "1990")

mauth2000_ACC <- as.data.frame(M2000ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "2000")
mauth2000_PREC <- as.data.frame(prec2000MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "2000")
mauth2000_RECALL <- as.data.frame(recall2000MAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "M")%>%
  mutate(pub_decade = "2000")
fauth2000_ACC <- as.data.frame(F2000ACC) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "2000")
fauth2000_PREC <- as.data.frame(prec2000FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F")%>%
  mutate(pub_decade = "2000")
fauth2000_RECALL <- as.data.frame(recall2000FAUTHS) %>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Accuracy = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "2000")
m2000_CM <- bind_rows(cm2000MAUTHS) %>%
  mutate(pub_decade = "2000")
f2000_CM <- bind_rows(cm2000FAUTHS) %>%
  mutate(pub_decade = "2000")
mauth2000_SENS <- as.data.frame(sens2000MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "2000")
mauth2000_SPEC <- as.data.frame(spec2000MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "2000")
fauth2000_SENS <- as.data.frame(sens2000FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Sensitivity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "2000")
fauth2000_SPEC <- as.data.frame(spec2000FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Specificity = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "2000")
fauth2000_NEGPRED <- as.data.frame(negpred2000FAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "F") %>%
  mutate(pub_decade = "2000")
mauth2000_NEGPRED <- as.data.frame(negpred2000MAUTHS)%>%
  gather() %>%
  select(-one_of("key")) %>%
  rename(Precision = 1) %>%
  mutate(auth_gender = "M") %>%
  mutate(pub_decade = "2000")

###Save Point
############################################################################
############################################################################
save(mauth_ACC, fauth_ACC, file = "ALLauthACC.RData")

save(mauth1850_ACC, mauth1860_ACC, mauth1870_ACC, mauth1880_ACC, mauth1890_ACC, mauth1900_ACC, 
     mauth1910_ACC, mauth1920_ACC, mauth1930_ACC, mauth1940_ACC, mauth1950_ACC,
     mauth1960_ACC, mauth1970_ACC, mauth1980_ACC, mauth1990_ACC, mauth2000_ACC,
     fauth1850_ACC, fauth1860_ACC, fauth1870_ACC, fauth1880_ACC, fauth1890_ACC, fauth1900_ACC, 
     fauth1910_ACC, fauth1920_ACC, fauth1930_ACC, fauth1940_ACC, fauth1950_ACC,
     fauth1960_ACC, fauth1970_ACC, fauth1980_ACC, fauth1990_ACC, fauth2000_ACC,
     file= "AUTHaccuracyData.RData")

save(mauth1850_PREC, mauth1860_PREC, mauth1870_PREC, mauth1880_PREC, mauth1890_PREC, mauth1900_PREC, 
     mauth1910_PREC, mauth1920_PREC, mauth1930_PREC, mauth1940_PREC, mauth1950_PREC,
     mauth1960_PREC, mauth1970_PREC, mauth1980_PREC, mauth1990_PREC, mauth2000_PREC,
     fauth1850_PREC, fauth1860_PREC, fauth1870_PREC, fauth1880_PREC, fauth1890_PREC, fauth1900_PREC, 
     fauth1910_PREC, fauth1920_PREC, fauth1930_PREC, fauth1940_PREC, fauth1950_PREC,
     fauth1960_PREC, fauth1970_PREC, fauth1980_PREC, fauth1990_PREC, fauth2000_PREC,
     file= "AUTHprecisionData.RData")

save(mauth1850_RECALL, mauth1860_RECALL, mauth1870_RECALL, mauth1880_RECALL, mauth1890_RECALL, mauth1900_RECALL, 
     mauth1910_RECALL, mauth1920_RECALL, mauth1930_RECALL, mauth1940_RECALL, mauth1950_RECALL,
     mauth1960_RECALL, mauth1970_RECALL, mauth1980_RECALL, mauth1990_RECALL, mauth2000_RECALL,
     fauth1850_RECALL, fauth1860_RECALL, fauth1870_RECALL, fauth1880_RECALL, fauth1890_RECALL, fauth1900_RECALL, 
     fauth1910_RECALL, fauth1920_RECALL, fauth1930_RECALL, fauth1940_RECALL, fauth1950_RECALL,
     fauth1960_RECALL, fauth1970_RECALL, fauth1980_RECALL, fauth1990_RECALL, fauth2000_RECALL,
     file= "AUTHprecallData.RData")

save(mauth1850_SENS, mauth1860_SENS, mauth1870_SENS, mauth1880_SENS, mauth1890_SENS, mauth1900_SENS, 
     mauth1910_SENS, mauth1920_SENS, mauth1930_SENS, mauth1940_SENS, mauth1950_SENS,
     mauth1960_SENS, mauth1970_SENS, mauth1980_SENS, mauth1990_SENS, mauth2000_SENS,
     fauth1850_SENS, fauth1860_SENS, fauth1870_SENS, fauth1880_SENS, fauth1890_SENS, fauth1900_SENS, 
     fauth1910_SENS, fauth1920_SENS, fauth1930_SENS, fauth1940_SENS, fauth1950_SENS,
     fauth1960_SENS, fauth1970_SENS, fauth1980_SENS, fauth1990_SENS, fauth2000_SENS,
     file= "AUTHsensData.RData")

save(mauth1850_SPEC, mauth1860_SPEC, mauth1870_SPEC, mauth1880_SPEC, mauth1890_SPEC, mauth1900_SPEC, 
     mauth1910_SPEC, mauth1920_SPEC, mauth1930_SPEC, mauth1940_SPEC, mauth1950_SPEC,
     mauth1960_SPEC, mauth1970_SPEC, mauth1980_SPEC, mauth1990_SPEC, mauth2000_SPEC,
     fauth1850_SPEC, fauth1860_SPEC, fauth1870_SPEC, fauth1880_SPEC, fauth1890_SPEC, fauth1900_SPEC, 
     fauth1910_SPEC, fauth1920_SPEC, fauth1930_SPEC, fauth1940_SPEC, fauth1950_SPEC,
     fauth1960_SPEC, fauth1970_SPEC, fauth1980_SPEC, fauth1990_SPEC, fauth2000_SPEC,
     file= "AUTHspecData.RData")

save(m1850_CM,m1860_CM, m1870_CM, m1880_CM, m1890_CM, m1900_CM, 
     m1910_CM, m1920_CM, m1930_CM, m1940_CM, m1950_CM, 
     m1960_CM, m1970_CM, m1980_CM, m1990_CM, m2000_CM,
     f1850_CM, f1860_CM, f1870_CM, f1880_CM, f1890_CM, f1900_CM, 
     f1910_CM, f1920_CM, f1930_CM, f1940_CM, f1950_CM, 
     f1960_CM, f1970_CM, f1980_CM, f1990_CM, f2000_CM,
     file="AUTHcm.RData")

combineCM <- bind_rows(m1880_CM, m1890_CM, m1900_CM, m1910_CM, m1920_CM, m1930_CM, m1940_CM, m1950_CM, m1960_CM, m1970_CM, m1980_CM, m1990_CM, m2000_CM,
                       f1880_CM, f1890_CM, f1900_CM, f1910_CM, f1920_CM, f1930_CM, f1940_CM, f1950_CM, f1960_CM, f1970_CM, f1980_CM, f1990_CM, f2000_CM)

combineACC <- bind_rows(mauth1850_ACC, mauth1860_ACC, mauth1870_ACC, mauth1880_ACC, mauth1890_ACC, mauth1900_ACC, 
                        mauth1910_ACC, mauth1920_ACC, mauth1930_ACC, mauth1940_ACC, mauth1950_ACC,
                        mauth1960_ACC, mauth1970_ACC, mauth1980_ACC, mauth1990_ACC, mauth2000_ACC,
                        fauth1850_ACC, fauth1860_ACC, fauth1870_ACC, fauth1880_ACC, fauth1890_ACC, fauth1900_ACC, 
                        fauth1910_ACC, fauth1920_ACC, fauth1930_ACC, fauth1940_ACC, fauth1950_ACC,
                        fauth1960_ACC, fauth1970_ACC, fauth1980_ACC, fauth1990_ACC, fauth2000_ACC)
write_csv(combineACC, "/Users/cheng/OneDrive/Desktop/character/character/4_build_models/Figure5Data.csv")


combinePREC <- bind_rows(mauth1880_PREC, mauth1890_PREC, mauth1900_PREC, mauth1910_PREC, mauth1920_PREC, mauth1930_PREC, mauth1940_PREC, mauth1950_PREC,
                         mauth1960_PREC, mauth1970_PREC, mauth1980_PREC, mauth1990_PREC, mauth2000_PREC,
                         fauth1880_PREC, fauth1890_PREC, fauth1900_PREC, fauth1910_PREC, fauth1920_PREC, fauth1930_PREC, fauth1940_PREC, fauth1950_PREC,
                         fauth1960_PREC, fauth1970_PREC, fauth1980_PREC, fauth1990_PREC, fauth2000_PREC)

combineRECALL <- bind_rows(mauth1850_RECALL, mauth1860_RECALL, mauth1870_RECALL, mauth1880_RECALL, mauth1890_RECALL, mauth1900_RECALL, 
                           mauth1910_RECALL, mauth1920_RECALL, mauth1930_RECALL, mauth1940_RECALL, mauth1950_RECALL,
                           mauth1960_RECALL, mauth1970_RECALL, mauth1980_RECALL, mauth1990_RECALL, mauth2000_RECALL,
                           fauth1850_RECALL, fauth1860_RECALL, fauth1870_RECALL, fauth1880_RECALL, fauth1890_RECALL, fauth1900_RECALL, 
                           fauth1910_RECALL, fauth1920_RECALL, fauth1930_RECALL, fauth1940_RECALL, fauth1950_RECALL,
                           fauth1960_RECALL, fauth1970_RECALL, fauth1980_RECALL, fauth1990_RECALL, fauth2000_RECALL) 


combineSPEC <- bind_rows(mauth1850_SPEC, mauth1860_SPEC, mauth1870_SPEC, mauth1880_SPEC, mauth1890_SPEC, mauth1900_SPEC, 
                         mauth1910_SPEC, mauth1920_SPEC, mauth1930_SPEC, mauth1940_SPEC, mauth1950_SPEC,
                         mauth1960_SPEC, mauth1970_SPEC, mauth1980_SPEC, mauth1990_SPEC, mauth2000_SPEC,
                         fauth1850_SPEC, fauth1860_SPEC, fauth1870_SPEC, fauth1880_SPEC, fauth1890_SPEC, fauth1900_SPEC, 
                         fauth1910_SPEC, fauth1920_SPEC, fauth1930_SPEC, fauth1940_SPEC, fauth1950_SPEC,
                         fauth1960_SPEC, fauth1970_SPEC, fauth1980_SPEC, fauth1990_SPEC, fauth2000_SPEC)

combineSENS <- bind_rows(mauth1850_SENS, mauth1860_SENS, mauth1870_SENS, mauth1880_SENS, mauth1890_SENS, mauth1900_SENS, 
                         mauth1910_SENS, mauth1920_SENS, mauth1930_SENS, mauth1940_SENS, mauth1950_SENS,
                         mauth1960_SENS, mauth1970_SENS, mauth1980_SENS, mauth1990_SENS, mauth2000_SENS,
                         fauth1850_SENS, fauth1860_SENS, fauth1870_SENS, fauth1880_SENS, fauth1890_SENS, fauth1900_SENS, 
                         fauth1910_SENS, fauth1920_SENS, fauth1930_SENS, fauth1940_SENS, fauth1950_SENS,
                         fauth1960_SENS, fauth1970_SENS, fauth1980_SENS, fauth1990_SENS, fauth2000_SENS)